/**
 * @author caif
 * @fileoverview thumbnailView
 * @extends file viewer
 */
App.Views.shareView = App.Views.itemView.extend({
	events: {
	    "click .inner-item"        : "update",
	    "dblclick .inner-item"     : "open"
	},
	
	initialize : function() {
		this.constructor.__super__.initialize.apply(this);
	},
    
    update: function(e){
         this.toggleDone(e);  
         App.viewInstances.appView.updateHeaderBtn();
    },
	render: function(){
		var self = this,
		template = tpl.share;
	    if(self.model.get('folder')){
	       self.model.set({'uiSize': ''}, {silent: true});
	       self.model.set({'uiExtension': App.i18n.get('folder')}, {silent: true});
	    }else{
	       self.model.set({'uiSize': self.getSize(self.model.get('size'))}, {silent: true});
	       self.model.set({'uiExtension': self.model.get('extension')}, {silent: true});
	    }
	    if(self.model.get('extension')){
           self.model.set({'uiName': self.model.get('name') + '.' + self.model.get('extension')}, {silent: true});
        }
	    self.model.set({'rootPath': App.viewInstances.appView.getRootPath()}, {silent: true});
	    self.model.set({'uiUpdateTime': self.getLocaleDate(self.model.get('updateTime'))}, {silent: true});
	    var jsonObj = self.model.toJSON();
	    if(self.model.get("dataBagId")){
	    	 jsonObj.processCommon = false;
		     self.processDatabag(self.model.get("dataBagId"), self.model.get("extension"), jsonObj, template);
		}else{
	         jsonObj.processCommon = true;
	         self.$el.html( Mustache.to_html(template, jsonObj)); 
	    }
	    self.$el.html( Mustache.to_html(template, jsonObj));
		self.input = this.$('.edit');
		return self;
	}
});
